package com.springboot.cloud.demos.ribbon.rest;

import com.springboot.cloud.common.core.entity.vo.Result;
import com.springboot.cloud.demos.entity.form.AppVersionForm;
import com.springboot.cloud.demos.ribbon.service.AppVersionService;
import com.springboot.cloud.demos.ribbon.service.BannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
public class AppVersionController {

    @Autowired
    private AppVersionService  appVersionService;

    @GetMapping("/appVersion/last")
    public Result banner(String platform) {
        return appVersionService.last(platform);
    }

    @GetMapping("/appVersion/list")
    public Result conditions() {
        return appVersionService.list();
    }

    @PostMapping("/appVersion")
    public Result add(@RequestBody AppVersionForm appVersionForm) {
        return appVersionService.save(appVersionForm);
    }

    @PutMapping(value = "/appVersion")
    public Result update(@RequestBody AppVersionForm appVersion) {
        return appVersionService.update(appVersion);
    }

    @GetMapping("/appVersion/{id}")
    public Result get(@PathVariable(value = "id") String id) {
        return appVersionService.appVersion(id);
    }

    @DeleteMapping("/appVersion/{id}")
    public Result delete(@PathVariable(value = "id") String id) {
        return appVersionService.delete(id);
    }

}
